<?php 
defined('LMO') or die('Can\'t access !'); 
$number = 0;
?>
<h2 class="title">Edit account</h2>
<form method="POST">
<table border="0" width="100%">
    <tr>
        <td class="lable" width="20%">Server name:</td>
        <td width="80%"><input type="text" name="server_name" class="inputtext w250" value="<?php echo $data['name']; ?>" /></td>
    </tr>
    <tr>
        <td class="lable">IP:</td>
        <td><input type="text" name="server_ip" class="inputtext w250" value="<?php echo $data['ip']; ?>" /></td>
    </tr>
    <?php 
    if(!empty($data['service'])):
    $number = count($data['service']);
    for($i = 0; $i < $number; $i++):
    $service = $data['service'][$i];
    ?>
    <tr>
        <td colspan="2">
            <div class="line"></div>
        </td>
    </tr>
    <tr>
        <td class="lable" width="20%">Service name:</td>
        <td width="80%"><input type="text" name="service_name_<?php echo $i; ?>" class="inputtext w250" value="<?php echo $service['name']; ?>" /></td>
    </tr>
    <tr>
        <td class="lable">IP:</td>
        <td><input type="text" name="service_ip_<?php echo $i; ?>" class="inputtext w250" value="<?php echo $service['ip']; ?>" /></td>
    </tr>
    <tr>
        <td class="lable">Port:</td>
        <td><input type="text" name="service_port_<?php echo $i; ?>" class="inputtext w250" value="<?php echo $service['port']; ?>" /></td>
    </tr>
    <tr>
        <td class="lable">Timeout:</td>
        <td><input type="text" name="service_timeout_<?php echo $i; ?>" class="inputtext w250" value="<?php echo $service['timeout']; ?>" /></td>
    </tr>
    <tr>
        <td class="lable">Alert:</td>
        <td><input type="text" name="service_alert_<?php echo $i; ?>" class="inputtext w250" value="<?php echo $service['alert']; ?>" /></td>
    </tr>
    <tr>
        <td class="lable">Enable:</td>
        <td>
            <input type="checkbox" name="service_enable_<?php echo $i; ?>" value="1" class="inputcheck" <?php echo ($service['enable'] == true)?'checked':''; ?> />
        </td>
    </tr>
    <?php 
    endfor;
    endif;
    ?>
    <tr>
        <td colspan="2">
            <div class="line"></div>
        </td>
    </tr>
    <tr>
        <td class="lable" width="20%">Service name:</td>
        <td width="80%"><input type="text" name="service_name_<?php echo $number; ?>" class="inputtext w250" /></td>
    </tr>
    <tr>
        <td class="lable">IP:</td>
        <td><input type="text" name="service_ip_<?php echo $number; ?>" class="inputtext w250" /></td>
    </tr>
    <tr>
        <td class="lable">Port:</td>
        <td><input type="text" name="service_port_<?php echo $number; ?>" class="inputtext w250" /></td>
    </tr>
    <tr>
        <td class="lable">Timeout:</td>
        <td><input type="text" name="service_timeout_<?php echo $number; ?>" class="inputtext w250" value="5" /></td>
    </tr>
    <tr>
        <td class="lable">Alert:</td>
        <td><input type="text" name="service_alert_<?php echo $number; ?>" class="inputtext w250" /></td>
    </tr>
    <tr>
        <td class="lable">Enable:</td>
        <td>
            <input type="checkbox" name="service_enable_<?php echo $number; ?>" value="1" class="inputcheck" />
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <div class="line"></div>
        </td>
    </tr>
    <tr>
        <td class="lable"></td>
        <td><input type="submit" value="Save" class="inputsubmit" /></td>
    </tr>
</table>
<input type="hidden" name="i" value="<?php echo $number; ?>" />
</form>